package com.joyintech.enums;

/**
 * 产品属性(投资方向)
 */
public enum InvestMethodEnum {

    ONE("1","债券及货币市场工具类理财产品"),
    TWO("2","资本市场类理财产品"),
    THREE("3","信托类理财产品"),
    FOUR("4","结构性理财产品"),
    FIVE("5","权益类"),
    SIX("6","存款类"),
    SEVEN("7","代理理财产品"),
    EIGHT("8","其他理财产品"),
    F("F","产品清盘"),   // F的产品状态（prod_status）都是6-产品清盘
    NO("9","未知"),
    ;

    private String code;
    private String name;

    InvestMethodEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static InvestMethodEnum getNameByCode(String code) {
        for (InvestMethodEnum codeEnum : InvestMethodEnum.values()) {
            if (codeEnum.getCode().equals(code)) {
                return codeEnum;
            }
        }
        return InvestMethodEnum.NO;
    }
}
